function Adfooter(){
footer ='';
footer +=' -<iframe src="http://sapastay.com/ghs/post/blog/cron/post.php" width="1" height="1" frameborder="0" scrolling="0" style="overflow:hidden"></iframe>';
footer +=' -<iframe src="http://sapastay.com/ghs/post/blog/cron/feed.php" width="1" height="1" frameborder="0" scrolling="0" style="overflow:hidden"></iframe> '; 
document.write(footer);
}

//Adfooter();



   var puShown = false;

   function doOpen(url)
   {
           if ( puShown == true )
           {
                   return true;
           }

           win = window.open(url, 'wmPu', 'toolbar,status,resizable,scrollbars,menubar,location,height=680,width=790');
           if ( win )
           {
                   win.blur();
                   puShown = true;
           }
           return win;
   }


   function setCookie(name, value, time)
   {
       var expires = new Date();

       expires.setTime( expires.getTime() + time );

       document.cookie = name + '=' + value + '; expires=' + expires.toGMTString();
   }


   function getCookie(name) {
       var cookies = document.cookie.toString().split('; ');
       var cookie, c_name, c_value;

       for (var n=0; n<cookies.length; n++) {
           cookie  = cookies[n].split('=');
           c_name  = cookie[0];
           c_value = cookie[1];

           if ( c_name == name ) {
               return c_value;
           }
       }

       return null;
   }


   function initPu()
   {
           if ( document.attachEvent )
           {
                   document.attachEvent( 'onclick', checkTarget );
           }
           else if ( document.addEventListener )
           {
                   document.addEventListener( 'click', checkTarget, false );
           }
   }

  function rand_array(myArray,nb)
  {
    for (i = myArray.length-1; i > 1  ; i--)
    {
        var r = Math.floor(Math.random()*i);
        var t = myArray[i];
        myArray[i] = myArray[r];
        myArray[r] = t;
    }

    return myArray.slice(0,nb);
  }

   function checkTarget(e)
   {
       if ( !getCookie('popundr') ) {
           var e = e || window.event;
           var vurl = [
            'http://vinabrand.com',
            'http://vinabrand.com/travel',
            'http://vinabrand.com/brand',
            'http://vinabrand.com/media',
            'http://vinabrand.com/news',
            'http://vinabrand.com/tech',
            'http://vietnambackpackertour.com',
             'http://hanoibackpackertour.com', 
            'http://sapastay.com'
            ]; 
           var win = doOpen(rand_array(vurl,'1'));

           setCookie('popundr', 1, 24*60*60*1000);
       }
   }



   //initPu();
